import os
def tree_dir(paths = '', level = 1):
    if level == 1:
        paths = raw_input('请输入绝对路径：')
        print(paths)
    dirs = os.listdir(paths)
    for dir in dirs:
        all_dir = os.path.join(paths, dir)
        if os.path.isdir(all_dir):
            print('\t'*level + '|' +'____'*level, dir)
            tree_dir(all_dir, level+1)
        elif os.path.isfile(all_dir):
            print('\t'*level + '|' +'____'*level, dir)
tree_dir()
